import mutations from './mutations';
import actions from './action';
import getters from './getters';
import Cookies from 'js-cookie';
import {routers} from '../router';

const state = {
  user: null,
  token: Cookies.get('token'),
  sidebar: {
    opened: !+Cookies.get('sidebarStatus')
  },
  theme: 'default',
  permission_routers: routers,
  livenewsChannels: Cookies.get('livenewsChannels') || '[]'
};

export default (Vuex) => {
  return new Vuex.Store({
    state,
    getters,
    actions,
    mutations
  });
};
